<template>
  <div class="dialog">
    <el-dialog width="60%" :title="title" :visible="true" :close-on-click-modal="false" :before-close="close">
      <Activity :id="id" :type="type" @close="close" @confirm="confirm" />
    </el-dialog>
  </div>
</template>

<script>
import Activity from './Activity.vue'
export default {
  name: 'AddActivity',
  components: {
    Activity
  },
  props: {
    type: {
      type: String,
      default: 'add' // add:新增  edit:编辑
    },
    id: {
      type: [String, Number],
      default: ''
    }
  },
  data() {
    return {
    }
  },

  computed: {
    title() {
      if (this.type === 'add') {
        return '新增活动'
      } else {
        return '编辑活动'
      }
    }
  },

  created() {
  },

  methods: {

    // 取消
    close() {
      this.$emit('close')
    },

    // 确认
    confirm() {
      this.$emit('confirm')
    }

  }

}
</script>

<style lang="scss" scoped></style>
